<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style"/>
		<meta content="telephone=no" name="format-detection"/>

<title>兑换中</title>
<script type="text/javascript">
	(function() {
		var el = document.createElement("STYLE");
		var docEl = document.documentElement;
		var portrait = ((Math.min(docEl.clientWidth, docEl.clientHeight) / 320) * 10);
		var landscape = ((Math.max(docEl.clientWidth, docEl.clientHeight) / 568) * 17.75);
		el.innerHTML = "@media screen and (orientation:portrait) { html { font-size: " + portrait + "px!important; } }\n@media screen and (orientation:landscape) { html { font-size: " + landscape + "px!important; } }";
		docEl.firstElementChild.appendChild(el);
	})();
	
	function onBridgeReady(){
		   WeixinJSBridge.invoke(
		       'getBrandWCPayRequest', {
	           "appId":"${payJSDataMap.appId}",     //公众号名称，由商户传入     
	           "timeStamp":"${payJSDataMap.timeStamp}", //时间戳，自1970年以来的秒数     
	           "nonceStr":"${payJSDataMap.nonceStr}", //随机串     
	           "package":"${payJSDataMap.packageString}",     
	           "signType":"${payJSDataMap.signType}",//微信签名方式：     
	           "paySign":"${payJSDataMap.paySign}" //微信签名 
		       },
		       function(res){ 
		    	   //微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
		    		window.location.href= "<%=path %>/check/trade/pay?chargeId=${chargeRecordVO.chargeId}&pagePayResult="+res.err_msg;		    	   
		       }
		   ); 
		}
		if (typeof WeixinJSBridge == "undefined"){
		   if( document.addEventListener ){
		       document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		   }else if (document.attachEvent){
		       document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
		       document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		   }
		}else{
		   onBridgeReady();
		}
		
		function toIndex(){
			window.location.href= "<%=path %>/index";
		}
</script>
<link href="<%=path %>/css/stlye.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="cg">
   <div class="cg_top"><img src="<%=path %>/images/ok.png"  height="" width="100%"/></div>
   <p>支付进行中</p>
   <span>请稍等！</span>
</div>
<div class="ann">
 <p style="background-color:#eee; color:#999;"  onclick="javascript:toIndex()">选择其他商品</p>
 <p onclick="javascript:onBridgeReady()">继续支付</p>
</div>
<jsp:include page="/views/html5/commons/footer.jsp"></jsp:include>
</body>
</html>
